package com.laiketui.admin.store.controller.store;

import com.laiketui.core.domain.Result;
import com.laiketui.domain.mch.AdminModel;
import com.laiketui.domain.user.User;
import com.laiketui.order.api.dto.ExamineOrderDTO;
import com.laiketui.order.api.dto.ExamineOrderDetailDTO;
import com.laiketui.order.api.dto.OrderOfflineExamineDTO;
import com.laiketui.order.api.feign.FinanceOrderFeign;
import com.laiketui.order.api.feign.StoreOrderFeign;
import com.laiketui.order.api.params.OrderInfoParams;
import com.laiketui.order.api.params.mch.MchOrderInfoParams;
import com.laiketui.order.api.params.store.ExamineOrderParams;
import com.laiketui.order.api.params.store.StoreOrderListParams;
import com.laiketui.root.annotation.HttpApiMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "后台-财务订单")
@RestController
@RequestMapping("/v2/order/finance")
public class FinanceOrderController extends AdminBaseController{

    @Autowired
    private FinanceOrderFeign financeOrderFeign;

    @ApiOperation("审核订单")
    @RequestMapping("/examine")
    @HttpApiMethod(apiKey = "admin.orderV2.examineOrder")
    public Result examine(@Validated ExamineOrderParams params){
        return Result.success(financeOrderFeign.examineOrder(params));
    }

    @ApiOperation("审核支付详情")
    @RequestMapping("/examinInfo")
    @HttpApiMethod(apiKey = "admin.orderV2.examinInfo")
    public Result examineInfo(@Validated OrderInfoParams params){
        return Result.success(financeOrderFeign.examineInfo(params));
    }

    @ApiOperation("财务订单审核详情列表")
    @HttpApiMethod(apiKey = "admin.orderV2.examineList")
    @RequestMapping("/examineList")
    public Result examineList(@Validated OrderInfoParams params){
        return Result.success(financeOrderFeign.examineList(params));
    }

    @ApiOperation("财务订单详情")
    @HttpApiMethod(apiKey = "admin.orderV2.examineOrderDetails")
    @RequestMapping("/orderDetails")
    public Result orderDetails(@Validated MchOrderInfoParams params){
        return Result.success(financeOrderFeign.orderDetails(params));
    }

    @ApiOperation("恢复待付款")
    @HttpApiMethod(apiKey = "admin.orderV2.returnWaitPay")
    @RequestMapping("/returnWaitPay")
    public Result returnWaitPay(String orderParentNo){
        return Result.success(financeOrderFeign.returnWaitPay(orderParentNo));
    }


}
